<template>
	<view class="search-item">
		<view class="uni-form-item uni-column">
			<image src="@/static/icons/搜索.png"></image>
			<input class="uni-input" placeholder-style="color:grey" placeholder="输入文章 活动" type="text" selection-start=5
				cursor-spacing=10px adjust-position confirm-type="search" />
			<text @click="searchquxiao()">{{Searchna}}</text>
		</view>
	</view>
</template>

<script>
	export default {
		name: "MySearch",
		data() {
			return {
				Searchna: this.$props.searchname
			};
		},
		props: ['searchname'],
		onLoad() {
			let pages = getCurrentPages();
			console.log('当前页面的路由：', pages[pages.length - 1].$page.fullPath)
		},
		methods: {
			searchquxiao() {
				if (this.Searchna == '取消') {

					uni.navigateBack();
					this.Searchna = ''
				} else {
					uni.navigateTo({
						url: '/pages/search/search'
					})
				}

			}
		}

	}
</script>

<style lang="scss" scoped>
	.search-item {
		width: 100%;
		height: 100rpx;
		color: black;
		margin-top: 20rpx;
		margin-left: 15rpx;
		position: relative;

		image {
			width: 40rpx;
			height: 40rpx;
			position: absolute;
			left: 8rpx;
			top: 10rpx;
		}

		.uni-input {
			display: block;
			width: 75%;
			height: 60rpx;
			background-color: #e6e6e6;
			border-radius: 20rpx;
			font-size: 25rpx;
			padding-left: 50rpx;
		}

		text {
			color: #1684fc;
			position: absolute;
			right: 40rpx;
			top: 12rpx;
			font-size: 30rpx;
		}
	}
</style>
